<?php

namespace App\Models\Bi;


use App\Models\RefundOrder;
use Illuminate\Database\Eloquent\Model;

class BillLog extends Model
{

    protected $table = "bill_logs";

    protected $connection = "bi";

    public $timestamps = false;

//    public $dateFormat = "U";

    const CREATED_AT = 'created_at';

    const UPDATED_AT = 'updated_at';

    protected $fillable = ['id',
        "pay_type",
        'oem_id', 'agent_id', 'store_id', 'cashier_id', 'out_trade_no',
        "refund_no",
        'device_code', 'trade_no', 'total_fee', 'receipt_fee', 'fee_amount', 'rate', 'refund_fee', 'pay_time', 'ways_type', 'ways_source', 'receive_model', 'oem_rate', 'agent1_id', 'agent1_rate', 'agent2_id', 'agent2_rate', 'agent3_id', 'agent3_rate', 'agent4_id', 'agent4_rate', 'oem_profit', 'agent1_profit', 'agent2_profit', 'agent3_profit', 'agent4_profit', 'status', 'day', 'created_at', 'updated_at',
        "oem_fee",
        "agent1_fee",
        "agent2_fee",
        "agent3_fee",
        "agent4_fee",
        "fee_amount",
        "company"
    ];

    public $casts = [
        "created_at" => "datetime:Y-m-d H:i:s",
        "updated_at" => "datetime:Y-m-d H:i:s"
    ];


    public function refundLog()
    {
        return $this->hasOne(RefundLog::class, "refund_no", "refund_no");
    }

}